.class Lcom/nemustech/regina/ReginaCheckForUpdate$2;
.super Landroid/content/BroadcastReceiver;
.source "ReginaCheckForUpdate.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/nemustech/regina/ReginaCheckForUpdate;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation


# instance fields
.field final synthetic this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;


# direct methods
.method constructor <init>(Lcom/nemustech/regina/ReginaCheckForUpdate;)V
    .locals 0
    .parameter

    .prologue
    .line 76
    iput-object p1, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$2;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    invoke-direct {p0}, Landroid/content/BroadcastReceiver;-><init>()V

    return-void
.end method


# virtual methods
.method public onReceive(Landroid/content/Context;Landroid/content/Intent;)V
    .locals 8
    .parameter "context"
    .parameter "intent"

    .prologue
    const/4 v6, 0x1

    const/4 v7, 0x0

    .line 80
    invoke-virtual {p2}, Landroid/content/Intent;->getAction()Ljava/lang/String;

    move-result-object v0

    .line 81
    .local v0, action:Ljava/lang/String;
    const-string v3, "android.intent.action.PACKAGE_ADDED"

    invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-nez v3, :cond_0

    const-string v3, "android.intent.action.PACKAGE_CHANGED"

    invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-eqz v3, :cond_1

    .line 83
    :cond_0
    invoke-virtual {p2}, Landroid/content/Intent;->getData()Landroid/net/Uri;

    move-result-object v3

    invoke-virtual {v3}, Landroid/net/Uri;->getSchemeSpecificPart()Ljava/lang/String;

    move-result-object v1

    .line 84
    .local v1, packageName:Ljava/lang/String;
    iget-object v3, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$2;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    invoke-virtual {v3, v1}, Lcom/nemustech/regina/ReginaCheckForUpdate;->findRecordByPackageName(Ljava/lang/String;)Lcom/nemustech/regina/XMLRecord;

    move-result-object v2

    .line 85
    .local v2, record:Lcom/nemustech/regina/XMLRecord;
    if-eqz v2, :cond_1

    .line 86
    invoke-virtual {v2}, Lcom/nemustech/regina/XMLRecord;->getCurrentVersionCode()I

    move-result v3

    packed-switch v3, :pswitch_data_0

    .line 93
    const-string v3, "ReginaCheckForUpdate"

    new-instance v4, Ljava/lang/StringBuilder;

    invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v2}, Lcom/nemustech/regina/XMLRecord;->getAppName()Ljava/lang/String;

    move-result-object v5

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    const-string v5, " was updated successfully"

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    iget-object v5, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$2;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    invoke-static {v5}, Lcom/nemustech/regina/ReginaCheckForUpdate;->access$100(Lcom/nemustech/regina/ReginaCheckForUpdate;)Z

    move-result v5

    invoke-static {v3, v4, v5}, Lcom/nemustech/regina/RLog;->d(Ljava/lang/String;Ljava/lang/String;Z)I

    .line 94
    iget-object v3, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$2;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    iget-object v4, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$2;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    const v5, 0x7f070070

    invoke-virtual {v4, v5}, Lcom/nemustech/regina/ReginaCheckForUpdate;->getString(I)Ljava/lang/String;

    move-result-object v4

    new-array v5, v6, [Ljava/lang/Object;

    invoke-virtual {v2}, Lcom/nemustech/regina/XMLRecord;->getAppName()Ljava/lang/String;

    move-result-object v6

    aput-object v6, v5, v7

    invoke-static {v4, v5}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v4

    invoke-static {v3, v4}, Lcom/nemustech/regina/RUtils;->showToast(Landroid/content/Context;Ljava/lang/String;)Landroid/widget/Toast;

    .line 98
    :goto_0
    iget-object v3, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$2;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    invoke-virtual {v3, v1}, Lcom/nemustech/regina/ReginaCheckForUpdate;->getCurrentVersion(Ljava/lang/String;)I

    move-result v3

    invoke-virtual {v2, v3}, Lcom/nemustech/regina/XMLRecord;->setCurrentVersion(I)V

    .line 99
    invoke-virtual {v2, v7}, Lcom/nemustech/regina/XMLRecord;->setTargeted(Z)V

    .line 100
    iget-object v3, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$2;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    invoke-static {v3, v7}, Lcom/nemustech/regina/ReginaCheckForUpdate;->access$202(Lcom/nemustech/regina/ReginaCheckForUpdate;Z)Z

    .line 101
    iget-object v3, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$2;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    invoke-static {v3}, Lcom/nemustech/regina/ReginaCheckForUpdate;->access$300(Lcom/nemustech/regina/ReginaCheckForUpdate;)Lcom/nemustech/regina/XMLRecordAdapter;

    move-result-object v3

    invoke-virtual {v3}, Lcom/nemustech/regina/XMLRecordAdapter;->notifyDataSetChanged()V

    .line 102
    iget-object v3, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$2;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    iget-object v4, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$2;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    invoke-virtual {v4}, Lcom/nemustech/regina/ReginaCheckForUpdate;->getAvailableUpdateItem()I

    move-result v4

    invoke-virtual {v3, v4}, Lcom/nemustech/regina/ReginaCheckForUpdate;->setStatus(I)V

    .line 105
    .end local v1           #packageName:Ljava/lang/String;
    .end local v2           #record:Lcom/nemustech/regina/XMLRecord;
    :cond_1
    return-void

    .line 88
    .restart local v1       #packageName:Ljava/lang/String;
    .restart local v2       #record:Lcom/nemustech/regina/XMLRecord;
    :pswitch_0
    const-string v3, "ReginaCheckForUpdate"

    new-instance v4, Ljava/lang/StringBuilder;

    invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v2}, Lcom/nemustech/regina/XMLRecord;->getAppName()Ljava/lang/String;

    move-result-object v5

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    const-string v5, " was installed successfully"

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    iget-object v5, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$2;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    invoke-static {v5}, Lcom/nemustech/regina/ReginaCheckForUpdate;->access$100(Lcom/nemustech/regina/ReginaCheckForUpdate;)Z

    move-result v5

    invoke-static {v3, v4, v5}, Lcom/nemustech/regina/RLog;->d(Ljava/lang/String;Ljava/lang/String;Z)I

    .line 89
    iget-object v3, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$2;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    iget-object v4, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$2;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    const v5, 0x7f07006f

    invoke-virtual {v4, v5}, Lcom/nemustech/regina/ReginaCheckForUpdate;->getString(I)Ljava/lang/String;

    move-result-object v4

    new-array v5, v6, [Ljava/lang/Object;

    invoke-virtual {v2}, Lcom/nemustech/regina/XMLRecord;->getAppName()Ljava/lang/String;

    move-result-object v6

    aput-object v6, v5, v7

    invoke-static {v4, v5}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v4

    invoke-static {v3, v4}, Lcom/nemustech/regina/RUtils;->showToast(Landroid/content/Context;Ljava/lang/String;)Landroid/widget/Toast;

    goto :goto_0

    .line 86
    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_0
    .end packed-switch
.end method
